package com.borened.netty;

import com.borened.netty.protocol.http.HttpServer;
import com.borened.netty.protocol.mqtt.MqttBroker;
import com.borened.netty.protocol.websocket.WebSocketServer;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.Resource;

/**
 * @author chengcaihua
 */

@SpringBootApplication
public class App implements CommandLineRunner {

    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
    }

    @Resource
    private MqttBroker mqttBroker;
    @Resource
    private HttpServer httpServer;

    @Resource
    private WebSocketServer webSocketServer;

    @Override
    public void run(String... args) throws Exception {
        mqttBroker.start(1883);
        httpServer.start(8081);
        webSocketServer.start(8084);
    }
}
